<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 2018/9/28
 * Time: 15:08
 */
/**
 * @var \admin\models\FormChangeAvatar $model
 */

use kartik\form\ActiveForm;
use common\components\tools\Url;
use common\components\tools\Html;
use budyaga\cropper\Widget;

$this->title = "切换头像";
$this->params['breadcrumbs'][] = Html::a('用户中心', ['site/profile']);
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="frontend-user-setting-change-avatar">
    <div class="row">
        <div class="col-md-3">
            <!-- Profile Image -->
            <?=$this->render('_profile_left_image') ?>
            <!-- /.box -->
        </div>
        <div class="col-sm-9">
            <?php $form = ActiveForm::begin(['id' => 'form-profile']); ?>
            <?php echo $form->field($model, 'avatar')->widget(Widget::class, [
                'uploadUrl' => Url::toRoute('uploadAvatar'),
            ]) ?>
            <div class="form-group">
                <?php echo Html::submitButton('保存', ['class' => 'btn btn-primary']) ?>
            </div>
            <?php ActiveForm::end(); ?>
        </div>
        <div class="col-sm-12">
            <?php // echo Html::img(Yii::$app->user->identity->getAvatarUrl()) ?>
        </div>
    </div>
</div>